#include "qgraphicdialog.h"
#include "ui_qgraphicdialog.h"
#include <QPainter>
#include <QPoint>
#include <qpaintutils.h>

QGraphicDialog::QGraphicDialog(QWidget *parent, QColor *color, QString text, QString diameter) :
    QDialog(parent),
    ui(new Ui::QGraphicDialog)
{
    ui->setupUi(this);
    this->text = text;
    this->color = color;
    this->diameter = diameter.toInt();
}

QGraphicDialog::~QGraphicDialog()
{
    delete ui;
}

void QGraphicDialog::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPoint center(width() / 2, height() / 2);
    QPaintUtils::drawCircle(&painter, &center, diameter, text, 20, color);
}
